﻿using SD.Infrastructure.Repository.EntityFrameworkCore;
using SlamDunk.MES.Domain.Entities.DefinitionContext;
using SlamDunk.MES.Domain.IRepositories.Interfaces.DefinitionContext;
using System;
using System.Collections.Generic;
using System.Linq;

namespace SlamDunk.MES.Repository.Implements.DefinitionContext
{
    /// <summary>
    /// 物料清单项仓储实现
    /// </summary>
    public class BomItemRepository : EFEntityRepositoryProvider<BomItem>, IBomItemRepository
    {
        #region # 获取物料清单项列表 —— ICollection<BomItem> Find(Guid bomId)
        /// <summary>
        /// 获取物料清单项列表
        /// </summary>
        /// <param name="bomId">物料清单Id</param>
        /// <returns>物料清单项列表</returns>
        public ICollection<BomItem> Find(Guid bomId)
        {
            IQueryable<BomItem> bomItems = base.Find(x => x.Bom.Id == bomId);

            return bomItems.ToList();
        }
        #endregion
    }
}
